package com.jsshse.dao.demand.impl;

import java.util.List;
import java.util.Map;

import org.apache.log4j.Logger;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Repository;

import com.jsshse.dao.base.impl.BaseDaoImpl;
import com.jsshse.dao.demand.DocDaoI;

@Repository("docDao")
public class DocDaoImpl <T> extends BaseDaoImpl<T> implements DocDaoI<T> {

	@Override
	public boolean add(Map param) {
		String v = (String) this.getSqlTemp().insert("demand.insertDoc", param);
		return v != null ? true : false;
	}

	@Override
	public boolean delete(String id) {
		int res = this.getSqlTemp().delete("demand.deleteDoc", id);
		return res > 0 ? true : false;
	}

	@Override
	public boolean update(Map param) {
		int res =this.getSqlTemp().update("demand.updateDoc",param);
		return res > 0 ? true : false;
	}

	@Override
	public Map queryById(String id) {
		return (Map) this.getSqlTemp().queryForObject("demand.queryDocById", id);
	}
	
	@Override
	public int queryForListCnt(Object paramCls) {
		return ((Integer) this.getSqlTemp().queryForObject(
				"demand.queryDocForListCnt", paramCls)).intValue();
	}

	@Override
	public List queryForListByPage(Object paramCls, int startRow, int pageRows) {
		return  this.getSqlTemp().queryForList("demand.queryDocForList",
				paramCls, startRow, pageRows);
	} 
 
}
